//
// Created by Scave on 2025/8/25.
//

#ifndef RIDER3D_RENDERNODE_H
#define RIDER3D_RENDERNODE_H

#include "Define.h"
#include "component/BasicComponents.h"

NS_RIDER_BEGIN

    enum struct LayerMask {
        Root = 0,
        Object,
        Ui,
    };

    enum struct NodeType {
        Standard = 0,
        Instancing,
        Skybox,
        Particle,
        Sprite,
        Canvas,
    };

    struct RenderNode {
        // 渲染顺序
        UInt16 order;
        // Layer标记
        LayerMask layer_mask = LayerMask::Object;
        String name;
        virtual NodeType Type() = 0;
    };

    struct LightItem {
        LightType type;
        float strength;
        Vec3 position;
        Vec3 direction;
        Color color;
        float range;
        LightAttenuation attenuation;
        float spotAngle;
    };

    struct StandardRenderNode : public RenderNode {
        RenderType render_type;
        Mesh* mesh;
        Material material;
        Mat4 mtx_model;
        Vec3 camera_pos;
        Color ambient_color;
        std::vector<LightItem> lights;

        NodeType Type() override;
    };

    struct InstancingRenderNode : public StandardRenderNode {
        std::vector<Mat4> model_matrices;

        NodeType Type() override;
    };

NS_RIDER_END

#endif //RIDER3D_RENDERNODE_H
